using System;
using Istace.Framework.Mapping.Core.Interfaces;

namespace Istace.Framework.Mapping.TestConsole
{
    /// <summary>
    /// Convert integer to string
    /// </summary>
    public class IntegerToStringMapper : IMapper<int, string>, IMapper<string, int>
    {
        public string Map(int instanceToMap)
        {
            return instanceToMap.ToString();
        }

        public int Map(string instanceToMap)
        {
            int value;
            Int32.TryParse(instanceToMap, out value);
            return value;
        }
    }

    /// <summary>
    /// Convert double to string
    /// </summary>
    public class DoubleToStringMapper : IMapper<double, string>
    {
        public string Map(double instanceToMap)
        {
            return instanceToMap.ToString();
        }
    }

    /// <summary>
    /// Convert B to string
    /// </summary>
    public class MapperOfBToString : IMapper<B, string>
    {
        public string Map(B instanceToMap)
        {
            return instanceToMap.Foo;
        }
    }

    public class A : B, IA { }
    public class C { }
    public interface IA { }

    public class B : C, IB
    {
        public string Foo { get; set; }
    }

    public interface IB
    {
        string Foo { get; set; }
    }
}